/**
 * Copyright European Commission's
 * Taxation and Customs Union Directorate-General (DG TAXUD).
 */
package com.eryos;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.eryos.bean.City;
import com.eryos.bean.Report;

/**
 * 
 * @author $Author: $
 * @version $Revision: $
 */
@RunWith(Parameterized.class)
public class City2Report extends ParametrizedReport {

    /** The Logger. */
    private static final Logger LOGGER = LoggerFactory.getLogger(City2Report.class);

    private static List<City> allCities = new ArrayList<City>();
    private static String reportName = "report_2.html";
    private static String reportTitle = "Zone 2 : moins 15 km à vol d'oiseau et moins de 10 km par la route";

    /**
     * Default constructor.
     */
    public City2Report(final String cityName) {
        super(cityName, 2);
    }

    @Parameters(name = "CityReport2({1})")
    public static Collection<Object[]> data() throws IOException {
        LOGGER.info("data()");

        initClass();

        return getAllCities(Constants.citiesLevel2);
    }

    @Test
    public void processCityTest() {
        this.processCity();

        // Add city
        allCities.add(this.getCity());
    }

    @AfterClass
    public static void generateReport() throws IOException {
        Report report = new Report("target/full_" + reportName, reportTitle);
        report.setListOfCities(allCities);
        report.generateReport();

        Report todayReport = new Report("target/today_" + reportName, reportTitle);
        todayReport.setListOfCities(allCities);
        todayReport.generateReport(true);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Logger getLogger() {
        return LOGGER;
    }

}
